package samples.d3.color 
{
	import color.HSL;
	import color.RGB;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.utils.setInterval;
	import samples.BaseSample;
	import shapes.shapes2D.curves.Spiral;
	import shapes.shapes2D.distribution.goldenRatio.GoldenRatio;
	import shapes.shapes2D.Quad;
	
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class Color3 extends BaseSample 
	{
		
		private var hsl:HSL;
		private var hue:int = 0;
		private var quad:Quad;
		
		public function Color3() 
		{
			
			hsl = new HSL();
			
			var points:Vector.<Point> = Spiral.compute( sw / 2, sh / 2, GoldenRatio.RATIO * 2, .75, 360 );
			for each( var p:Point in points ) 
			{
			
				var quad:Quad = new Quad( new Rectangle( 0, 0, 50, 50 ) );
				
				
				quad.x = p.x;
				quad.y = p.y;
				
				hsl.hue++;
				quad.rotation = -hsl.hue;
				
				quad.fillColor = quad.strokeColor = hsl.toHex();
				quad.draw();
				
				addChild( quad );
				
			}
		}
		
		
	}

}